package mylibrary.socket;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Test {

	public static void main(String[] args) throws IOException {
		
		ServerSocket server = new ServerSocket(100);
		
		System.out.println("Test");
		
		while(true) {
			Socket socket = server.accept();
			
			System.out.println("This is the accept");
			
			socket.getOutputStream().write("12345".getBytes());
			
			byte[] b = new byte[1024];
			
			InputStream stream = socket.getInputStream();
			
			stream.read(b);
			
			System.out.println(b);
			
			String s = new String(b);
			
			System.out.println("This is the content: " + s);
			
		}
		
	}
}
